package com.flyco.modules.stm.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.flyco.modules.stm.entity.StmChannelProductApply;
import com.flyco.modules.stm.mapper.StmChannelProductApplyMapper;
import com.flyco.modules.stm.service.IStmChannelProductApplyService;
import com.flyco.modules.stm.service.IStmChannelProductApplyItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 渠道产品申请表
 * @Author: flyco
 * @Date: 2023-06-21
 * @Version: V1.0
 */
@Service
public class StmChannelProductApplyServiceImpl extends ServiceImpl<StmChannelProductApplyMapper, StmChannelProductApply> implements IStmChannelProductApplyService {

    @Autowired
    private IStmChannelProductApplyItemService itemService;

    @Override
    public void updateApplyStatusByApprove(Integer applyId) {

        Integer status = itemService.getApproveStatus(applyId);
        LambdaQueryWrapper<StmChannelProductApply> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(StmChannelProductApply::getApplyId, applyId);

        StmChannelProductApply applyInfo = getOne(queryWrapper);
        applyInfo.setStatus(status);
        updateById(applyInfo);
    }

    @Override
    public void sendMailAfterApprove(Integer applyId,Integer status){

        if(status.equals(2)){
            //
        }

    }
}
